<?php




// 处理引号，HTML标签引起的输入框显示错误，过滤字符型变量
$process_include    = array('username', 'school_name');
string_pre_process($record, $process_include);

if($action == 'modify') {
    $can_not_modify_pass = "<input type=\"checkbox\" name=\"members[can_not_modify_pass]\" id=\"can_not_modify_pass\" value=\"1\" onclick=\"return fun_can_not_modify_pass(this);\" checked> <label for=\"can_not_modify_pass\">不修改密码</label>";
    $display_confirm_pass   = 'none';
    $display_pass_word      = 'none';
    $can_not_modify_name    = 'readonly';
    $password_dataType      = "";
    $lab_user_data_title    = "修改会员";
    $cur_tab_menu           = "not_exist";
    $javascript             = <<<EOT
<SCRIPT LANGUAGE="JavaScript">
<!--
var d='';
var isIE=!!window.ActiveXObject; 
if (isIE){ 
    d='';
}
function fun_can_not_modify_pass(o_chk) {
    var this_form = o_chk.form;

    var tr1 = GE('tr_pass_word');
    var tr2 = GE('tr_confirm_pass');
    if(o_chk.checked){
        GE('password').dataType = '';
        tr1.style.display = 'none';
        tr2.style.display = 'none';
    } else {
        GE('password').dataType = 'Limit';
        tr1.style.display = d;
        tr2.style.display = d;
    }
}
//-->
</SCRIPT>
EOT;
} else {
    $display_confirm_pass   = ' ';
    $display_pass_word      = ' ';
    $can_not_modify_pass    = "";
    $can_not_modify_name    = '';
    $password_dataType      = "Limit";
    $lab_user_data_title    = "新增会员";
    $cur_tab_menu           = "admin_add";
    $javascript             = '';
}


if($record['img'] != '') {
    $this_link_url = $G_web_upload . $record['img'];
} else {
    if($record['gender']    == '0') {
        $this_link_url = $url_global['common'] . '/images/nan.jpg';
    } elseif($record['gender']  == '1') {
        $this_link_url = $url_global['common'] . '/images/nv.jpg';
    } else {
        $this_link_url = $url_global['common'] . '/images/nan.jpg';
    }
}

$gender_check_0    = $record['gender'] == 0 ? 'selected' : '' ;
$gender_check_1    = $record['gender'] == 1 ? 'selected' : '' ;



//$chk_can_not_repass = $record['canrepass'] == 1 ? '' : ' checked';
//$txt_lasttime   = $record['lasttime'] > 0 ? date(DATE_TIME_FORMAT, $record['lasttime']) : '尚未登录';

$regdate = $record['regdate'] > 0 ? date("Y-m-d", $record['regdate']) : '未知';


//$birthday = $record['birthday'] > 0 ? date("Y-m-d", $record['birthday']) : date("Y-m-d", time());

$type   = @(int)$record['type'];
$class_type_check_0 = $type == 0 ? 'checked' : 'checked' ;
$class_type_check_1 = $type == 1 ? 'checked' : '' ;
$class_type_display = $type == 1 ? "" : "style=\"display:none\"" ;
$class_type_display2 = $type == 1 ? "" : "style=\"display:none\"" ;


require($abs_admin_cppath . '/header.php');




// 取得返回字符串
$back_url   = strcode(getcookie('back_url'), 'DECODE');
if($back_url == '') $back_url   = $mod_url['li'];



// 取所有学校
$tbl_article   = $_TABLES['article'];
$conn   = & get_db_conn();
$sql    = "SELECT aid,article_title FROM $tbl_article WHERE cata_id = 1 ORDER BY aid DESC ";
$rs     = $conn->Execute($sql);
$view   = $rs->GetRows();
?>
<?php echo $javascript ?>
<div class="sp_height_5px"></div>

<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common']; ?>/js/Validator.js"></SCRIPT>
<script type="text/javascript" src="<?php echo $G_web_root; ?>/js/jquery.js"></script>
<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common']; ?>/js/popcalendar.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--

var d='';
var isIE=!!window.ActiveXObject; 
if (isIE){ 
    d='';
}

function fun_card_pass()
{
    var card = document.forms['item_data'].elements['members[type]'].value
    var tr1 = document.getElementById('tr_card_name');
    var tr2 = document.getElementById('tr_card_name2');
    
    if(card != 0)
    {
        tr1.style.display = 'none';
        tr2.style.display = 'none';
    }
    else
    {
        tr1.style.display = d;
        tr2.style.display = d;
    }
}

function fun_card_pass_no()
{
    var card = document.forms['item_data'].elements['members[type]'].value
    var tr1 = document.getElementById('tr_card_name');
    var tr2 = document.getElementById('tr_card_name2');
    
    if(card == 0)
    {
        tr1.style.display = 'none';
        tr2.style.display = 'none';
    }
    else
    {
        tr1.style.display = d;
        tr2.style.display = d;
    }
}

function sszd(x)
{
    var url	= '<?php echo $G_web_root;?>'+'/ajax/getstation.php?site_id='+x+'&name=article&station_id='+<?php echo isset($record['station_id'])?$record['station_id']:0; ?>;
	$.get(url,
		function(data){
			$("#station_list").html(unescape(data));
		});
}
<?php if($record['site_id']!=0){?>
window.load=sszd(<?php echo $record['site_id'];?>)
<?}?>
//-->
</SCRIPT>







		<div class="datacontainer2" style="width:500px;">
<div class="header">
	<?php echo $lab_user_data_title?>
</div>
<form action="<?php echo $mod_url['save']; ?>" method="post" name="item_data" onsubmit="return Validator.Validate(this,3)" enctype="multipart/form-data" >
<table BORDER="0" cellpadding="0" cellspacing="0" width="100%" class="list_table">

<tr style="display: ">
	<td width="160" align="right" class="caption">用户名：</td>
	<td class="cell">
		<input type="text" name="members[username]" value="<?php echo $record['username']; ?>" class="text" 
		<?php echo $can_not_modify_name; ?>
		dataType="Require" msg="登录用户名必须填写且必须符合上述规则">
		<span class="mustfill">*</span> <?php echo $can_not_modify_pass; ?>
		<div class="hint">用户名由a～z的英文字母(不区分大小写)、0～9的数字、点、减号或下划线组成，长度为3～18个字符，只能以数字或字母开头和结尾。例如:myname_01。</div>
	</td>
</tr>
<tr>
    <td width="120" align="center" class="td2">类型：</td>
    <td class="td1" colspan="2">
        <input type="radio" name="members[personal]" value="0" <?php if(!$record['personal']){?>checked=""<?php }?>/> 个人&nbsp;&nbsp;&nbsp;
        <input type="radio" name="members[personal]" value="1" <?php if($record['personal']){?>checked=""<?php }?>/> 企业
    </td>
  </tr>
  <tr>
    <td width="120" align="center" class="td2">属性：</td>
    <td class="td1" colspan="2">
    <?php foreach($user_type_array as $k=>$v){?>
        <input type="radio" name="members[attr]" class="attr" value="<?php echo $k;?>" <?php if(in_array($k,$record['attr'])){?>checked="checked" <?php }?> /> <?php echo $v;?>
    <?php }?>
    </td>
  </tr>
<tr id="tr_pass_word" style="display:<?php echo $display_pass_word?>">
	<td width="160" align="right" class="caption">登录密码：</td>
	<td class="cell">
		<input type="password" name="members[password]" id='password' value="" class="text"
		dataType="<?php echo $password_dataType?>" min="6" max="30" msg="登录密码必须填写且必须符合上述规则">
		<span class="mustfill">*</span>
		<div class="hint">密码可由除半角字符“'”和“"”以外的可打印字符组成(区分大小写)，长度为6～30个字符。 <br>修改用户信息时如果不填写本项则不修改用户登录密码。</div>
	</td>
</tr>
<tr id="tr_confirm_pass" style="display:<?php echo $display_confirm_pass?>">
	<td width="120" align="right" class="caption">确认密码：</td>
	<td class="cell"><input type="password" name="members[confirmpass]" value="" class="text"
		dataType="Repeat" to="password" msg="两次输入的密码不一致">
		<span class="mustfill">*</span>
		<div class="hint">请确认一次您刚才输入的密码使之同“<B>登录密码</B>”项保持一致。</div>
	</td>
</tr>

 <TR>
    <TD width="120" align="right" class="caption">真实姓名：</TD>
	<TD class="cell">
		<INPUT TYPE="text" NAME="members[realname]" value="<?php echo $record['realname'];?>" size="50" class="text">
	</TD>
</TR>




<TR>
    <TD width="120" align="right" class="caption">性别：</TD>
	<TD class="cell">
		<SELECT NAME="members[gender]" style=" width:100px;">
                <OPTION VALUE="0" <?php echo $gender_check_0;?>>男
                <OPTION VALUE="1" <?php echo $gender_check_1;?>>女
        </SELECT>
		</div>
	</TD>
</TR>



<TR>
    <TD width="120" align="right" class="caption">手机号码：</TD>
	<TD class="cell">
		<INPUT TYPE="text" NAME="members[tel]" value="<?php echo $record['tel'];?>" size="50" class="text">
		</div>
	</TD>
</TR>

<TR>
    <TD width="120" align="right" class="caption">E-mail：</TD>
	<TD class="cell">
		<INPUT TYPE="text" NAME="members[email]" value="<?php echo $record['email'];?>" size="50" class="text">
		</div>
	</TD>
</TR>

<TR>
	<TD width="120" align="right" class="caption">上传头像：</TD>
	<TD class="FormCell">

<TABLE border="0" cellpadding="0" cellspacing="0" class="non_border">
<TR>
	<TD height="80"><a href="<?php echo $this_link_url; ?>" target="_blank"><img src="<?php echo $this_link_url; ?>" id="obj_thumb_img" width="110" height="120" border="0"></a></TD>
</TR>
<TR>
	<TD>
<input type="file" name="img" class="text" onchange="return file_img_onchange(this, 'obj_thumb_img');"> 
<INPUT TYPE="checkbox" NAME="members[delimg]" id="delimg" value="1"> <label for="delimg">删除图片</label>
	</TD>
</TR>
</TABLE>
	</TD>
</TR>


<TR>
	<TD width="120" align="right" class="caption">注册时间：</TD>
	<TD class="cell"><span class="time01">
    <input type="text" name="members[regdate]" id="regdate" value="<?php echo $regdate?>" class="text" size="12" style="font-size:10px">
	<script language=JavaScript>
	<!--
		arrowtag("regdate",'<?php echo $url_global['common']; ?>/images/datetime.gif');
	//-->
	</script>
    </span></TD>
</TR>

<TR>
    <TD width="120" align="right" class="caption">其他说明：</TD>
	<TD class="cell">
		<textarea name="members[content]" cols="50" rows="5"><?php echo $record['content'];?></textarea>
	</TD>
</TR>
<TR>
    <TD width="120" align="right" class="caption">黄金劵：</TD>
	<TD class="cell">
		<?php echo $record['balance'];?> 张  <a href="?mod=acc&action=li&userid=<?php echo $record['uid'];?>">账户记录</a>
	</TD>
</TR>

<TR>
	<TD class="submit" colspan="2">
		<input type="submit" value=" 保存 " class="btn">
		<input type="reset" value=" 重置 " class="btn">
		<input type="button" value=" 返回 " class="btn" onclick="location.href='<?php echo $back_url; ?>'">
		<input type="hidden" name="back_url" value="<?php echo $back_url; ?>">
        <input type="hidden" name="members[old_password]" value="<?php echo $record['password']; ?>">
		<input type="hidden" name="members[uid]" value="<?php echo $record['uid']; ?>">
		<input type="hidden" name="save" value="<?php echo $save_flag; ?>">
	</TD>
</TR>
</table>
</form>


		</div>

<script>
var d='';
var isIE=!!window.ActiveXObject; 
if (isIE){ 
    d=' ';
}
function ch(va){
    if(va==3||va==4){
        $('#ch2').css('display',d);
        if($('.qx').val()=='1'){
            $('#ch4').css('display',d);
            $('#ch5').css('display',d);
            $('#ch').css('display','none');
            $('#ch1').css('display','none');
        }else{
            $('#ch4').css('display','none');
            $('#ch5').css('display','none');
            $('#ch').css('display',d);
            $('#ch1').css('display',d);
        }
    }else{
        $('#ch').css('display','none');
        $('#ch1').css('display','none');
        $('#ch2').css('display','none');
        $('#ch4').css('display','none');
        $('#ch5').css('display','none');
    }
}
function ch1(va){
    if(va==1){
        $('#ch4').css('display',d);
        $('#ch5').css('display',d);
            $('#ch').css('display','none');
            $('#ch1').css('display','none');
    }else{
         $('#ch4').css('display','none');
         $('#ch5').css('display','none');
            $('#ch').css('display',d);
            $('#ch1').css('display',d);
    }
}
window.load=ch(<?php echo $record['type'];?>);
</script>
<script>
function sszd(x){
	var url	= '<?php echo $G_web_root;?>/ajax/getcity.php?city='+x;
	$.get(url,function(data){
			$("#city_list").html(unescape(data));
	});
}
<?php if($record['city']){?>
    var url	= '<?php echo $G_web_root;?>/ajax/getcity.php?city=510000&not=y&sel=<?php echo $record['city'];?>';
	$.get(url,function(data){
			$("#city").html(unescape(data));
	});
    <?php if($record['city1']){?>
    var url	= '<?php echo $G_web_root;?>/ajax/getcity.php?city=<?php echo $record['city'];?>&sel=<?php echo $record['city1'];?>';
	$.get(url,function(data){
			$("#city_list").html(unescape(data));
	});

<?php }
    else{
        ?>
        var url	= '<?php echo $G_web_root;?>/ajax/getcity.php?city=<?php echo $record['city'];?>&sel=0';
    	$.get(url,function(data){
    			$("#city_list").html(unescape(data));
    	});
        <?php 
    }
}else{
    ?>
    var url	= '<?php echo $G_web_root;?>/ajax/getcity.php?city=510000&not=y';
	$.get(url,function(data){
			$("#city").html(unescape(data));
	});
    var url	= '<?php echo $G_web_root;?>/ajax/getcity.php?city=510100&sel=0';
	$.get(url,function(data){
			$("#city_list").html(unescape(data));
	});
    <?php
}

?>
</script>
<?php
require($abs_admin_cppath . '/footer.php');
?>